home *** CD-ROM | disk | FTP | other *** search
- /* $VER: ParseRFC 1.0 (13.05.94)
-
- by Johan Billing
-
- This ARexx scripts shows you how you can parse the RFC messages generated
- with the ROBOTNAME function in CrashMail.
-
- Syntax: rx ParseRFC.rexx <file>
-
- */
-
- IF ~SHOW(Libraries,'rexxsupport.library') THEN
- IF ~ADDLIB("rexxsupport.library",0,-30,0) THEN EXIT
-
- parse arg file
-
- toname=""
- toaddr=""
- fromname=""
- fromaddr=""
- date=""
- subject=""
-
- call open('file',file,'R')
-
- /* keep going */
-
- kg=TRUE
-
- do while kg=TRUE
- str = readln('file')
-
- if eof('file') then do
- kg=FALSE
- end
- else if length(str)=0 then do
-
- /* *** Empty line = End of header *** */
-
- kg=FALSE
- end
- else do
- if left(str,5)="From:" then parse var str 'From: 'fromaddr'@'dummy' ('fromname')'
- if left(str,3)="To:" then parse var str 'To: 'toaddr'@'dummy' ('toname')'
- if left(str,5)="Date:" then date=right(str,length(str)-6)
- if left(str,8)="Subject:" then subject=right(str,length(str)-9)
- end
- end
-
- do while ~eof('file')
- str = readln('file')
-
- /* Process text here! */
-
- end
-
- call close('file')
-
- /* This IS just a stupid demo... */
-
- say "From:" fromname "(" || fromaddr || ")"
- say " To:" toname "(" || toaddr || ")"
- say "Subj:" subject
- say "Date:" date
- say
-
- /* If we exit 10, CrashMail will import the message. If you set the exit level
- to 0, the message will be killed. If you want CrashMail to stop tossing,
- return 20 or higher */
-
- exit 10
-